package com.ticket.web.controller.yanchu;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ticket.common.annotation.Log;
import com.ticket.common.core.controller.BaseController;
import com.ticket.common.core.domain.AjaxResult;
import com.ticket.common.enums.BusinessType;
import com.ticket.system.domain.YanchuOrderLog;
import com.ticket.system.service.IYanchuOrderLogService;
import com.ticket.common.utils.poi.ExcelUtil;
import com.ticket.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2024-03-14
 */
@RestController
@RequestMapping("/system/log")
public class YanchuOrderLogController extends BaseController
{
    @Autowired
    private IYanchuOrderLogService yanchuOrderLogService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:log:list')")
    @GetMapping("/list")
    public TableDataInfo list(YanchuOrderLog yanchuOrderLog)
    {
        startPage();
        List<YanchuOrderLog> list = yanchuOrderLogService.selectYanchuOrderLogList(yanchuOrderLog);
        return getDataTable(list);
    }

    /**
     * 查询最近30条列表
     */
    @GetMapping("/listRecent/forAllUser")
    public List<Map<String,Object>> listTab()
    {
        List<Map<String,Object>> list = yanchuOrderLogService.selectRecentOrderLogList();
        return list;
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:log:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YanchuOrderLog yanchuOrderLog)
    {
        List<YanchuOrderLog> list = yanchuOrderLogService.selectYanchuOrderLogList(yanchuOrderLog);
        ExcelUtil<YanchuOrderLog> util = new ExcelUtil<YanchuOrderLog>(YanchuOrderLog.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:log:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yanchuOrderLogService.selectYanchuOrderLogById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:log:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YanchuOrderLog yanchuOrderLog)
    {
        return toAjax(yanchuOrderLogService.insertYanchuOrderLog(yanchuOrderLog));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:log:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YanchuOrderLog yanchuOrderLog)
    {
        return toAjax(yanchuOrderLogService.updateYanchuOrderLog(yanchuOrderLog));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:log:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yanchuOrderLogService.deleteYanchuOrderLogByIds(ids));
    }
}
